package com.sentiment.file;

import java.io.IOException;

import com.sentiment.obj.Word;

/**
 * Getting word sentiment
 * 
 * @author Lakshmi Mallampati
 *
 */
public interface SentimentFile {
	
	/**
	 * Write the word to the file.
	 * Format: 
	 * word weight
	 * Example: 
	 * happy 0.80654895
	 * 
	 * Main purpose is to upload initial data.
	 * After that this method is implicitly called by getWeight when needed.
	 * 
	 * @param word is the Word object
	 */
	public void saveToFile(Word word) throws IOException;
	
	
	/**
	 * First Reads the File, which is loaded into memory, for the word.
	 * If the word is not found, get's the word weight, saves it to file and memory 
	 * and returns the weight to the user.
	 * 
	 * @param wordName
	 * @return wordWeight 
	 */
	public Double getWeight(String wordName) throws IOException ;

}
